<template>
  <div class="admin-registration-management">
    <!-- 页面头部 -->
    <div class="page-header">
      <div class="header-content">
        <h1 class="page-title">报名管理</h1>
        <p class="page-subtitle">管理系统中的所有报名记录</p>
      </div>
      <div class="header-actions">
        <el-button @click="exportData">
          <el-icon><Download /></el-icon>
          导出数据
        </el-button>
      </div>
    </div>

    <!-- 统计卡片 -->
    <el-row :gutter="20" class="stats-row">
      <el-col :xs="12" :sm="6">
        <el-card class="stats-card">
          <div class="stats-content">
            <div class="stats-info">
              <div class="stats-number">{{ stats.total }}</div>
              <div class="stats-label">总报名数</div>
            </div>
            <el-icon class="stats-icon"><Tickets /></el-icon>
          </div>
        </el-card>
      </el-col>
      
      <el-col :xs="12" :sm="6">
        <el-card class="stats-card">
          <div class="stats-content">
            <div class="stats-info">
              <div class="stats-number">{{ stats.pending }}</div>
              <div class="stats-label">待审核</div>
            </div>
            <el-icon class="stats-icon pending"><Clock /></el-icon>
          </div>
        </el-card>
      </el-col>
      
      <el-col :xs="12" :sm="6">
        <el-card class="stats-card">
          <div class="stats-content">
            <div class="stats-info">
              <div class="stats-number">{{ stats.approved }}</div>
              <div class="stats-label">已通过</div>
            </div>
            <el-icon class="stats-icon approved"><Check /></el-icon>
          </div>
        </el-card>
      </el-col>
      
      <el-col :xs="12" :sm="6">
        <el-card class="stats-card">
          <div class="stats-content">
            <div class="stats-info">
              <div class="stats-number">{{ stats.rejected }}</div>
              <div class="stats-label">已拒绝</div>
            </div>
            <el-icon class="stats-icon rejected"><Close /></el-icon>
          </div>
        </el-card>
      </el-col>
    </el-row>

    <!-- 搜索和筛选 -->
    <el-card class="filter-card">
      <el-form :model="filters" :inline="true" class="filter-form">
        <el-form-item label="关键词">
          <el-input
            v-model="filters.keyword"
            placeholder="搜索学生姓名、学号"
            clearable
            style="width: 200px"
            @keyup.enter="loadRegistrations"
          >
            <template #prefix>
              <el-icon><Search /></el-icon>
            </template>
          </el-input>
        </el-form-item>
        
        <el-form-item label="活动">
          <el-select 
            v-model="filters.activityId" 
            placeholder="选择活动" 
            clearable 
            filterable
            style="width: 200px"
          >
            <el-option 
              v-for="activity in activityOptions" 
              :key="activity.id"
              :label="activity.title" 
              :value="activity.id" 
            />
          </el-select>
        </el-form-item>
        
        <el-form-item label="组织者">
          <el-input
            v-model="filters.organizer"
            placeholder="搜索组织者"
            clearable
            style="width: 150px"
          />
        </el-form-item>
        
        <el-form-item label="状态">
          <el-select v-model="filters.status" placeholder="选择状态" clearable style="width: 120px">
            <el-option label="待审核" value="pending" />
            <el-option label="已通过" value="approved" />
            <el-option label="已拒绝" value="rejected" />
            <el-option label="已取消" value="cancelled" />
          </el-select>
        </el-form-item>
        
        <el-form-item label="报名时间">
          <el-date-picker
            v-model="filters.dateRange"
            type="daterange"
            range-separator="至"
            start-placeholder="开始日期"
            end-placeholder="结束日期"
            format="YYYY-MM-DD"
            value-format="YYYY-MM-DD"
            style="width: 240px"
          />
        </el-form-item>
        
        <el-form-item>
          <el-button type="primary" @click="loadRegistrations">
            <el-icon><Search /></el-icon>
            搜索
          </el-button>
          <el-button @click="resetFilters">
            <el-icon><Refresh /></el-icon>
            重置
          </el-button>
        </el-form-item>
      </el-form>
    </el-card>

    <!-- 报名列表 -->
    <el-card class="table-card">
      <template #header>
        <div class="table-header">
          <div class="header-title">
            <span>报名列表</span>
            <span class="total-count">（共 {{ pagination.total }} 条）</span>
          </div>
          <div class="header-actions">
            <el-button 
              type="success" 
              size="small" 
              :disabled="selectedRegistrations.length === 0"
              @click="batchApprove"
            >
              批量通过
            </el-button>
            <el-button 
              type="warning" 
              size="small" 
              :disabled="selectedRegistrations.length === 0"
              @click="batchReject"
            >
              批量拒绝
            </el-button>
            <el-button 
              type="danger" 
              size="small" 
              :disabled="selectedRegistrations.length === 0"
              @click="batchDelete"
            >
              批量删除
            </el-button>
          </div>
        </div>
      </template>
      
      <div v-if="loading" class="loading-container">
        <el-skeleton :rows="5" animated />
      </div>
      
      <div v-else-if="registrations.length === 0" class="empty-container">
        <el-empty description="暂无报名数据" />
      </div>
      
      <div v-else>
        <el-table
          :data="registrations"
          @selection-change="handleSelectionChange"
          stripe
          style="width: 100%"
        >
          <el-table-column type="selection" width="55" />
          
          <el-table-column label="学生信息" width="150">
            <template #default="{ row }">
              <div class="student-info">
                <el-avatar :src="row.student.avatar" :size="32">
                  {{ row.student.realName?.charAt(0) || row.student.username?.charAt(0) }}
                </el-avatar>
                <div class="student-details">
                  <div class="student-name">{{ row.student.realName }}</div>
                  <div class="student-id">{{ row.student.studentId }}</div>
                </div>
              </div>
            </template>
          </el-table-column>
          
          <el-table-column label="联系方式" width="140">
            <template #default="{ row }">
              <div class="contact-info">
                <div class="email">{{ row.student.email }}</div>
                <div class="phone">{{ row.student.phone }}</div>
              </div>
            </template>
          </el-table-column>
          
          <el-table-column label="学院/专业" width="140">
            <template #default="{ row }">
              <div class="college-info">
                <div class="college">{{ row.student.college }}</div>
                <div class="major">{{ row.student.major }}</div>
              </div>
            </template>
          </el-table-column>
          
          <el-table-column prop="activity.title" label="活动名称" width="200" show-overflow-tooltip />
          
          <el-table-column label="组织者" width="120">
            <template #default="{ row }">
              <div class="organizer-info">
                <div class="organizer-name">{{ row.activity.organizerName }}</div>
                <div class="organizer-org">{{ row.activity.organizerOrg }}</div>
              </div>
            </template>
          </el-table-column>
          
          <el-table-column label="状态" width="80">
            <template #default="{ row }">
              <el-tag :type="getStatusType(row.status)" size="small">
                {{ getStatusText(row.status) }}
              </el-tag>
            </template>
          </el-table-column>
          
          <el-table-column prop="registeredAt" label="报名时间" width="120">
            <template #default="{ row }">
              {{ formatDate(row.registeredAt, 'MM-DD HH:mm') }}
            </template>
          </el-table-column>
          
          <el-table-column prop="reviewedAt" label="审核时间" width="120">
            <template #default="{ row }">
              {{ row.reviewedAt ? formatDate(row.reviewedAt, 'MM-DD HH:mm') : '-' }}
            </template>
          </el-table-column>
          
          <el-table-column label="备注" width="120" show-overflow-tooltip>
            <template #default="{ row }">
              {{ row.remarks || '-' }}
            </template>
          </el-table-column>
          
          <el-table-column label="操作" width="200" fixed="right">
            <template #default="{ row }">
              <el-button type="text" size="small" @click="viewDetail(row)">
                查看
              </el-button>
              <el-button 
                v-if="row.status === 'pending'"
                type="text" 
                size="small" 
                @click="approveRegistration(row)"
              >
                通过
              </el-button>
              <el-button 
                v-if="row.status === 'pending'"
                type="text" 
                size="small" 
                @click="showRejectDialog(row)"
              >
                拒绝
              </el-button>
              <el-button 
                v-if="row.status === 'approved'"
                type="text" 
                size="small" 
                @click="cancelRegistration(row)"
              >
                取消
              </el-button>
              <el-button type="text" size="small" @click="deleteRegistration(row)" class="danger">
                删除
              </el-button>
            </template>
          </el-table-column>
        </el-table>
        
        <!-- 分页 -->
        <div class="pagination-container">
          <el-pagination
            v-model:current-page="pagination.page"
            v-model:page-size="pagination.size"
            :total="pagination.total"
            :page-sizes="[10, 20, 50, 100]"
            layout="total, sizes, prev, pager, next, jumper"
            @size-change="loadRegistrations"
            @current-change="loadRegistrations"
          />
        </div>
      </div>
    </el-card>

    <!-- 报名详情对话框 -->
    <el-dialog
      v-model="detailDialogVisible"
      title="报名详情"
      width="800px"
    >
      <div v-if="currentRegistration" class="registration-detail">
        <el-descriptions :column="2" border>
          <el-descriptions-item label="学生头像">
            <el-avatar :src="currentRegistration.student.avatar" :size="60">
              {{ currentRegistration.student.realName?.charAt(0) || currentRegistration.student.username?.charAt(0) }}
            </el-avatar>
          </el-descriptions-item>
          <el-descriptions-item label="报名状态">
            <el-tag :type="getStatusType(currentRegistration.status)">
              {{ getStatusText(currentRegistration.status) }}
            </el-tag>
          </el-descriptions-item>
          <el-descriptions-item label="学号">{{ currentRegistration.student.studentId }}</el-descriptions-item>
          <el-descriptions-item label="姓名">{{ currentRegistration.student.realName }}</el-descriptions-item>
          <el-descriptions-item label="性别">
            {{ currentRegistration.student.gender === 'male' ? '男' : '女' }}
          </el-descriptions-item>
          <el-descriptions-item label="年级">{{ currentRegistration.student.grade }}</el-descriptions-item>
          <el-descriptions-item label="学院">{{ currentRegistration.student.college }}</el-descriptions-item>
          <el-descriptions-item label="专业">{{ currentRegistration.student.major }}</el-descriptions-item>
          <el-descriptions-item label="班级">{{ currentRegistration.student.class }}</el-descriptions-item>
          <el-descriptions-item label="邮箱">{{ currentRegistration.student.email }}</el-descriptions-item>
          <el-descriptions-item label="联系电话">{{ currentRegistration.student.phone }}</el-descriptions-item>
          <el-descriptions-item label="活动名称">{{ currentRegistration.activity.title }}</el-descriptions-item>
          <el-descriptions-item label="组织者">{{ currentRegistration.activity.organizerName }}</el-descriptions-item>
          <el-descriptions-item label="组织/部门">{{ currentRegistration.activity.organizerOrg }}</el-descriptions-item>
          <el-descriptions-item label="报名时间">
            {{ formatDate(currentRegistration.registeredAt, 'YYYY-MM-DD HH:mm:ss') }}
          </el-descriptions-item>
          <el-descriptions-item label="审核时间">
            {{ currentRegistration.reviewedAt ? formatDate(currentRegistration.reviewedAt, 'YYYY-MM-DD HH:mm:ss') : '未审核' }}
          </el-descriptions-item>
          <el-descriptions-item label="审核人">
            {{ currentRegistration.reviewedBy || '-' }}
          </el-descriptions-item>
          <el-descriptions-item label="备注" :span="2">
            {{ currentRegistration.remarks || '无' }}
          </el-descriptions-item>
          <el-descriptions-item v-if="currentRegistration.rejectReason" label="拒绝原因" :span="2">
            {{ currentRegistration.rejectReason }}
          </el-descriptions-item>
        </el-descriptions>
      </div>
    </el-dialog>

    <!-- 拒绝报名对话框 -->
    <el-dialog
      v-model="rejectDialogVisible"
      title="拒绝报名"
      width="500px"
      @close="resetRejectForm"
    >
      <el-form
        ref="rejectFormRef"
        :model="rejectForm"
        :rules="rejectRules"
        label-width="80px"
      >
        <el-form-item label="拒绝原因" prop="reason">
          <el-input 
            v-model="rejectForm.reason" 
            type="textarea" 
            :rows="4"
            placeholder="请输入拒绝原因"
          />
        </el-form-item>
      </el-form>
      
      <template #footer>
        <el-button @click="rejectDialogVisible = false">取消</el-button>
        <el-button type="primary" @click="submitReject" :loading="submittingReject">
          确定拒绝
        </el-button>
      </template>
    </el-dialog>
  </div>
</template>

<script setup>
import { ref, reactive, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import { formatDate } from '@/utils'
import { ElMessage, ElMessageBox } from 'element-plus'
import api from '@/utils/api'
import {
  Download,
  Tickets,
  Clock,
  Check,
  Close,
  Search,
  Refresh
} from '@element-plus/icons-vue'

const router = useRouter()

const loading = ref(false)
const detailDialogVisible = ref(false)
const rejectDialogVisible = ref(false)
const submittingReject = ref(false)
const rejectFormRef = ref()

const stats = reactive({
  total: 0,
  pending: 0,
  approved: 0,
  rejected: 0
})

const filters = reactive({
  keyword: '',
  activityId: '',
  organizer: '',
  status: '',
  dateRange: null
})

const pagination = reactive({
  page: 1,
  size: 20,
  total: 0
})

const registrations = ref([])
const selectedRegistrations = ref([])
const currentRegistration = ref(null)
const activityOptions = ref([])

const rejectForm = reactive({
  id: null,
  reason: ''
})

const rejectRules = {
  reason: [
    { required: true, message: '请输入拒绝原因', trigger: 'blur' }
  ]
}

const getStatusType = (status) => {
  const typeMap = {
    pending: 'warning',
    approved: 'success',
    rejected: 'danger',
    cancelled: 'info'
  }
  return typeMap[status] || ''
}

const getStatusText = (status) => {
  const textMap = {
    pending: '待审核',
    approved: '已通过',
    rejected: '已拒绝',
    cancelled: '已取消'
  }
  return textMap[status] || status
}

const loadStats = async () => {
  try {
    const response = await api.get('/admin/registrations/stats')
    const data = response.data.data
    
    Object.assign(stats, data)
    
  } catch (error) {
    console.error('加载统计数据失败:', error)
  }
}

const loadActivityOptions = async () => {
  try {
    const response = await api.get('/admin/activities/options')
    activityOptions.value = response.data.data || []
  } catch (error) {
    console.error('加载活动选项失败:', error)
  }
}

const loadRegistrations = async () => {
  try {
    loading.value = true
    
    const params = {
      page: pagination.page,
      size: pagination.size,
      ...filters
    }
    
    if (filters.dateRange && filters.dateRange.length === 2) {
      params.startDate = filters.dateRange[0]
      params.endDate = filters.dateRange[1]
    }
    
    const response = await api.get('/admin/registrations', { params })
    const data = response.data.data
    
    registrations.value = data.list || []
    pagination.total = data.total || 0
    
  } catch (error) {
    console.error('加载报名列表失败:', error)
    ElMessage.error('加载报名列表失败')
  } finally {
    loading.value = false
  }
}

const resetFilters = () => {
  Object.assign(filters, {
    keyword: '',
    activityId: '',
    organizer: '',
    status: '',
    dateRange: null
  })
  pagination.page = 1
  loadRegistrations()
}

const handleSelectionChange = (selection) => {
  selectedRegistrations.value = selection
}

const viewDetail = async (registration) => {
  try {
    const response = await api.get(`/admin/registrations/${registration.id}`)
    currentRegistration.value = response.data.data
    detailDialogVisible.value = true
  } catch (error) {
    ElMessage.error('获取报名详情失败')
  }
}

const approveRegistration = async (registration) => {
  try {
    await ElMessageBox.confirm(
      `确定要通过 ${registration.student.realName} 的报名申请吗？`,
      '确认通过',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'success'
      }
    )
    
    await api.put(`/admin/registrations/${registration.id}/approve`)
    ElMessage.success('审核通过')
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error !== 'cancel') {
      ElMessage.error('操作失败')
    }
  }
}

const showRejectDialog = (registration) => {
  rejectForm.id = registration.id
  rejectForm.reason = ''
  rejectDialogVisible.value = true
}

const resetRejectForm = () => {
  rejectForm.id = null
  rejectForm.reason = ''
  if (rejectFormRef.value) {
    rejectFormRef.value.resetFields()
  }
}

const submitReject = async () => {
  try {
    await rejectFormRef.value.validate()
    
    submittingReject.value = true
    
    await api.put(`/admin/registrations/${rejectForm.id}/reject`, {
      reason: rejectForm.reason
    })
    
    ElMessage.success('已拒绝报名')
    rejectDialogVisible.value = false
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error.response?.data?.message) {
      ElMessage.error(error.response.data.message)
    } else {
      ElMessage.error('操作失败')
    }
  } finally {
    submittingReject.value = false
  }
}

const cancelRegistration = async (registration) => {
  try {
    await ElMessageBox.confirm(
      `确定要取消 ${registration.student.realName} 的报名吗？`,
      '确认取消',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }
    )
    
    await api.put(`/admin/registrations/${registration.id}/cancel`)
    ElMessage.success('已取消报名')
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error !== 'cancel') {
      ElMessage.error('操作失败')
    }
  }
}

const deleteRegistration = async (registration) => {
  try {
    await ElMessageBox.confirm(
      `确定要删除 ${registration.student.realName} 的报名记录吗？此操作不可恢复。`,
      '确认删除',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }
    )
    
    await api.delete(`/admin/registrations/${registration.id}`)
    ElMessage.success('删除成功')
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error !== 'cancel') {
      ElMessage.error('删除失败')
    }
  }
}

const batchApprove = async () => {
  try {
    await ElMessageBox.confirm(
      `确定要通过选中的 ${selectedRegistrations.value.length} 个报名申请吗？`,
      '确认批量通过',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'success'
      }
    )
    
    const ids = selectedRegistrations.value.map(reg => reg.id)
    await api.put('/admin/registrations/batch-approve', { ids })
    
    ElMessage.success('批量通过成功')
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error !== 'cancel') {
      ElMessage.error('批量通过失败')
    }
  }
}

const batchReject = async () => {
  try {
    const { value: reason } = await ElMessageBox.prompt(
      `确定要拒绝选中的 ${selectedRegistrations.value.length} 个报名申请吗？`,
      '批量拒绝',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        inputPlaceholder: '请输入拒绝原因',
        inputValidator: (value) => {
          if (!value) {
            return '请输入拒绝原因'
          }
          return true
        }
      }
    )
    
    const ids = selectedRegistrations.value.map(reg => reg.id)
    await api.put('/admin/registrations/batch-reject', { ids, reason })
    
    ElMessage.success('批量拒绝成功')
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error !== 'cancel') {
      ElMessage.error('批量拒绝失败')
    }
  }
}

const batchDelete = async () => {
  try {
    await ElMessageBox.confirm(
      `确定要删除选中的 ${selectedRegistrations.value.length} 个报名记录吗？此操作不可恢复。`,
      '确认批量删除',
      {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }
    )
    
    const ids = selectedRegistrations.value.map(reg => reg.id)
    await api.delete('/admin/registrations/batch', { data: { ids } })
    
    ElMessage.success('批量删除成功')
    loadRegistrations()
    loadStats()
    
  } catch (error) {
    if (error !== 'cancel') {
      ElMessage.error('批量删除失败')
    }
  }
}

const exportData = async () => {
  try {
    const response = await api.get('/admin/registrations/export', {
      params: filters,
      responseType: 'blob'
    })
    
    const blob = new Blob([response.data], {
      type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
    })
    
    const url = window.URL.createObjectURL(blob)
    const link = document.createElement('a')
    link.href = url
    link.download = `报名数据_${formatDate(new Date(), 'YYYY-MM-DD')}.xlsx`
    link.click()
    
    window.URL.revokeObjectURL(url)
    ElMessage.success('导出成功')
    
  } catch (error) {
    ElMessage.error('导出失败')
  }
}

onMounted(() => {
  loadStats()
  loadActivityOptions()
  loadRegistrations()
})
</script>

<style scoped>
.admin-registration-management {
  max-width: 1400px;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 8px;
  color: white;
}

.header-content {
  flex: 1;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.page-subtitle {
  font-size: 14px;
  opacity: 0.9;
  margin: 0;
}

.header-actions {
  display: flex;
  gap: 12px;
  margin-left: 20px;
}

.stats-row {
  margin-bottom: 24px;
}

.stats-card {
  cursor: pointer;
  transition: transform 0.3s ease;
}

.stats-card:hover {
  transform: translateY(-2px);
}

.stats-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
}

.stats-info {
  flex: 1;
}

.stats-number {
  font-size: 24px;
  font-weight: 700;
  color: #303133;
  margin-bottom: 4px;
}

.stats-label {
  font-size: 14px;
  color: #909399;
}

.stats-icon {
  font-size: 28px;
  opacity: 0.3;
  color: #409eff;
}

.stats-icon.pending {
  color: #e6a23c;
}

.stats-icon.approved {
  color: #67c23a;
}

.stats-icon.rejected {
  color: #f56c6c;
}

.filter-card,
.table-card {
  margin-bottom: 20px;
}

.filter-form {
  margin-bottom: 0;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #303133;
}

.total-count {
  font-size: 12px;
  color: #909399;
  font-weight: normal;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.loading-container,
.empty-container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

.student-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.student-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.student-name {
  font-size: 13px;
  color: #303133;
  font-weight: 600;
}

.student-id {
  font-size: 12px;
  color: #909399;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email {
  font-size: 12px;
  color: #303133;
}

.phone {
  font-size: 12px;
  color: #909399;
}

.college-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.college {
  font-size: 13px;
  color: #303133;
}

.major {
  font-size: 12px;
  color: #909399;
}

.organizer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.organizer-name {
  font-size: 13px;
  color: #303133;
}

.organizer-org {
  font-size: 12px;
  color: #909399;
}

.pagination-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
}

.registration-detail {
  max-height: 600px;
  overflow-y: auto;
}

.danger {
  color: #f56c6c !important;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }
  
  .header-actions {
    margin-left: 0;
    flex-direction: column;
  }
  
  .filter-form {
    flex-direction: column;
  }
  
  .filter-form .el-form-item {
    margin-right: 0;
    margin-bottom: 16px;
  }
  
  .table-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
  
  .header-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
  
  .student-info {
    flex-direction: column;
    gap: 4px;
  }
}
</style>